package com.jk.dmhomeprovider.controller;

import com.jk.dmcommon.wlentity.CityEntity;
import com.jk.dmcommon.wlentity.GoodsDetailEntity;
import com.jk.dmcommon.wlentity.SwiperEntity;
import com.jk.dmhomeprovider.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;

/**
 * 文件名称:HomeController
 *
 * @Description //TODO
 * @Date 2021/9/8 13:54
 * 作者 王乐
 * Copyright (c) 2021,  All Rights Reserved.</pre>
 */
@RestController
public class HomeController {
    @Autowired
    private HomeService homeService;
    /**
    *  @方法描述 (查询首页各种售票信息)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/8 14:08
     * @Param [goods]
     * @return java.util.List<com.jk.dmcommon.wlentity.GoodsDetailEntity>
     **/
    @RequestMapping(value = "/home/getHomeGoods",method = RequestMethod.POST)
    public List<GoodsDetailEntity> getHomeGoods(@RequestBody GoodsDetailEntity goods){
        return homeService.getHomeGoods(goods);
    }
    /**
    *  @方法描述 (轮播图查询)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/9 15:50
     * @Param []
     * @return java.util.List<SwiperEntity>
     **/
    @RequestMapping("home/getSwiper")
    public List<SwiperEntity> getSwiper(){
        return homeService.getSwiper();
    }
    /**
    *  @方法描述 (查询城市)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/10 10:05
     * @Param []
     * @return java.lang.String
     **/
    @RequestMapping("home/getCity")
    public String getCity(){
        return homeService.getCity();
    }
    /**
    *  @方法描述 (获取登录信息)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/13 6:53
     * @Param []
     * @return java.util.HashMap<java.lang.String,java.lang.Object>
     **/
    @RequestMapping("home/getLoginInfo")
    public HashMap<String,Object> getLoginInfo(){
        return homeService.getLoginInfo();
    }
    /**
     * 热门城市回显
     * hotCity
     */
    @RequestMapping("home/hotCity")
    public String hotCity(){
        return homeService.hotCity();
    }

    /**
     * 选中替换
     * @return
     */
    @RequestMapping("home/obtainCity")
    public String obtainCity(Integer cityid){
        return homeService.obtainCity(cityid);
    }
    /**
    *  @方法描述 (退出登录)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/14 1:24
     * @Param []
     * @return void
     **/
    @RequestMapping("home/logout")
    public void logout(){
        homeService.logout();
    }
}
